﻿

$(function () {
    $.extend({
        limitString: function (str, length, postfix) {
            var rtnstr = str;
            postfix = postfix || "...";

            if (rtnstr && rtnstr.length > length) {
                rtnstr = rtnstr.substring(0, length);
                rtnstr += postfix;
            }

            return rtnstr;
        },

        preventSpecialKey: function () {
            //            var eve = document.all ? window.event : event;

            //            $("body").keydown(function (event) {
            //                if (eve.keyCode == 13) return false;

            //                if ((event.altKey) || (event.keyCode == 116)
            //            || ((event.keyCode == 8) && (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password"))
            //            || ((event.ctrlKey) && ((event.keyCode == 78) || (event.keyCode == 82)))) {
            //                    event.keyCode = 0;
            //                    event.returnValue = false;
            //                    return false;
            //                }
            //            });
        }
    });
});